﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EntityObjects;
using BAL.Controller;
using PresentationLayer.Reports;



namespace PresentationLayer.View.Reports
{
    public partial class Report_DeptConsumption : System.Web.UI.Page
    {
        string m1;
        Employee employee = new Employee();


        protected void Page_Load(object sender, EventArgs e)
        {
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            employee = (Employee)Session["CurrentUser"];
            string dept = employee.DeptId;
            
            m1 = (DropDownList1.SelectedValue);

            DS_DepConsumption ds = new DS_DepConsumption();
            PresentationLayer.Reports.DS_DepConsumptionTableAdapters.ConsumptionTableAdapter ta = new PresentationLayer.Reports.DS_DepConsumptionTableAdapters.ConsumptionTableAdapter();
            ta.Fill(ds.Consumption,dept,Convert.ToDecimal(m1));
            PresentationLayer.Reports.Report_DeptConsumption rep = new PresentationLayer.Reports.Report_DeptConsumption();
            rep.SetDataSource(ds);
            CrystalReportViewer5.ReportSource = rep;
         

         
        }

        protected void Print_Click(object sender, EventArgs e)
        {
            employee = (Employee)Session["CurrentUser"];
            string dept = employee.DeptId;
            string m1 =DropDownList1.SelectedItem.Value;
            Response.Redirect("Print_DeptConsumption.aspx?m1="+m1+"&dept="+dept);
            
        }

        //private void SetPrintOptions()
        //{
        //    PrintOptions printOptions = hierarchicalGroupingReport.PrintOptions;
        //    printOptions.PrinterName = CURRENT_PRINTER;
        //    printOptions.PaperOrientation = (PaperOrientation)paperOrientationList.SelectedIndex;
        //    printOptions.PaperSize = (PaperSize)paperSizeList.SelectedIndex;
        //    printOptions.PrinterDuplex = (PrinterDuplex)printerDuplexList.SelectedIndex;
        //    printOptions.CustomPaperSource = GetSelectedPaperSource();
        //}
    }
}